<?php
require("../../class/connect.php");
include("../../class/config.php");
$getvar=$_GET['getvar'];
$returnvar=$_GET['returnvar'];
$fun=$_GET['fun'];
//--------------------html编辑器
$htmlareacode="<script type=\"text/javascript\">
      _editor_url = \"../editor\";
      _editor_lang = \"en\";
    </script>

<script type=\"text/javascript\" src=\"../editor/htmlareatemplate.php\"></script>
<script type=\"text/javascript\" src=\"../editor/plugins/FullPage/full-page.js\"></script>
<script type=\"text/javascript\" src=\"../editor/plugins/FullPage/lang/en.js\"></script>

<script type=\"text/javascript\">
//HTMLArea.loadPlugin(\"FullPage\");

var editor = null;
function initEditor() {
editor = new HTMLArea(\"pagetext\");
editor.registerPlugin(FullPage);

editor.generate();
return false;
}

function InsertFile(html) {
	editor.focusEditor();
	editor.insertHTML(html);
}
    </script>";
	//风格
$loginadminstyleid=(int)getcvar('loginadminstyleid');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>在线编辑模板</title>
<link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
<?=$htmlareacode?>
<script>
function SaveTemp()
{
var isok=confirm('确认要保存?');
if(isok)
{
<?=$returnvar?>=editor.getHTML();
window.close();
}
return false;
}
</script>
</head>

<body onload="initEditor()">
  
<table width="100%" border="0" cellspacing="1" cellpadding="3" class="tableborder">
  <form name="edittemp" method="post" action="../enews.php" onsubmit="return SaveTemp()">
    <tr class="header"> 
      <td>在线编辑模板</td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF">
<div align="center"> 
          <input type="button" name="Submit" value=" 保存内容 " onclick="return SaveTemp()">
        </div></td>
    </tr>
    <tr> 
      <td bgcolor="#FFFFFF">
<textarea id="pagetext" name="pagetext" style="height:40em; width:100%;"></textarea></td>
    </tr>
    <tr> 
      <td bgcolor="#FFFFFF">
<div align="center">
          <input type="button" name="Submit2" value=" 保存内容 " onclick="return SaveTemp()">
        </div></td>
    </tr>
	</form>
  </table>
<script>
var mytext=<?=$getvar?>;
//mytext=mytext.replace("<","&lt;");
//mytext=mytext.replace(">","&gt;");
document.edittemp.pagetext.value=mytext;
</script>
</body>
</html>
